<title>充值到余额 - 期金管家</title>
<style type="text/css">
    /*银行卡列表*/
    .chooseCard label{ border: 1px solid #da251c;padding:0 10px 0 5px; cursor:pointer;}
    /*.chooseCard label:hover{ border: 1px solid #da251c;}*/
    /*.chooseCard label.active{ border: 1px solid #da251c;}*/
</style>
{include file="Public/header"/}
<!--正文-->
<div class="container">
	 <form  action="/home/Apaycard/the" method="post">
    <div class="row chooseCard">
        <div class="col-md-12 mt20">
            <p class="h3">充值到余额 <b class="text-success">{$ste.toamount}</b>元(手续费{$ste.charge}元)</p>
        </div>

        <div class="col-md-12 mt20">
            <div class="col-md-2 col-md-offset-2 text-right mt10">充值方式：</div>
            <div class="col-md-3">
                <!--<input type="radio" name="channelToken" name="aaa" id="cardGDYH">-->
                <!--<label for="cardGDYH" class="active">-->
                    <label for="cardNYYH" class="active">
                        <span class="bank-name">
                        	<img src="http://gl.lcqjgj.com/upload/bank/{$ste.vimg}" alt=""></span>
                        <span class="fn-left icon-cardNo">****{:substr($ste.cerdid,-4)}</span>
                 
                </label>
            </div>

        </div>
        <div class="col-md-12 mt20">
            <div class="col-md-2 col-md-offset-2 text-right mt10">充值金额：</div>
            <div class="col-md-3">
                <div class="input-group">
                    <input type="text" class="form-control" name="toamount" value="{$ste.toamount}" aria-label="充值金额" readonly="readonly">
                    <span class="input-group-addon">元</span>
                </div>
            </div>
            <div class="col-md-3 mt05"></div>
        </div>
        <div class="col-md-12 mt20">
            <div class="col-md-2 col-md-offset-2 text-right mt10">手机验证码：</div>
            <div class="col-md-3">
                <div class="input-group">
                    <span class="input-group-addon"><span class="glyphicon glyphicon-qrcode"></span></span>
                     <input type="hidden" class="form-control" name="cerdid" value="{$ste.cerdid}" readonly="readonly">
                    <input type="hidden" class="form-control" name="toamount" value="{$ste.toamount}" aria-label="充值金额" readonly="readonly">
                    <input type="hidden" class="form-control" name="charge" value="{$ste.charge}" readonly="readonly">
                    <input type="text" class="form-control" name="code" id="uSmsCode" placeholder="手机验证码" value="" >
                    <div class="input-group-btn">
                        <!--<a class="btn btn-default btn-success" id="btnSmsCode">获取验证码</a>-->
                        <input type="button" class="btn btn-default btn-success" id="btnSmsCode" value="获取验证码">
                    </div>
                </div>
            </div>
        </div>
        <div class="col-md-12">
            <button class="btn btn-primary mt20 col-md-offset-4" style="padding:10px 50px;"  >确认充值</button>
        </div>
    </div>
    </form>
</div>


<div class="clearfix blank30"></div>
<!--版权信息-->
{include file="Public/footer"/}

<script type="text/javascript" src="/static/home/js/jquery-3.3.1.min.js"></script>
<script>

//  $("#btnSmsCode").click(function () {
//      //调用获取验证码60S函数
//      settime(this);
//  });

    //获取验证码60S函数
    var countdown = 60;
    function settime(obj) {
        if (countdown == 0) {
            obj.removeAttribute("disabled");
            obj.value = "获取验证码";
            countdown = 60;
            return;
        } else {
            obj.setAttribute("disabled", true);
            obj.value = "重新发送(" + countdown + ")";
            countdown--;
        }
        setTimeout(function () {
                settime(obj)
            }
            , 1000)
    }
    
        //获取手机短信码
    $("#btnSmsCode").click(function invokeSettime(obj) {
    	obj=this;
       // settime(this);
        
        /*$.post('__ROOT__/home/Userrecharge/pageadds', {name:name,cer:cer,card:card,phone:phone,code:code}, function (data) {
                // alert(data);
                var objs = JSON.parse(data);
                if (objs.msg != 'success') {
                    $("#mobile").html(objs.msg).show().css("color", "red");
                    $("#btnSmsCode").attr("disabled", "disabled");
                    // flag = false;
                } else {
                    // flag = true;
                }
            });*/
            // 线下
            var formData = new FormData();
            formData.append("toamount", $("input[name='toamount']").val());
            formData.append("cerdid", $("input[name='cerdid']").val());
            formData.append("code",0);
            $.ajax({
                url: '__ROOT__/home/Apaycard/the',
                type: 'POST',
                data: formData,
                processData: false,
                contentType: false,
                success: function (data) {
                       if(data.respDesc!='成功'){
                    	alert(data.respDesc);
                    }else{
                    	//alert(111);
                    	settime(obj);
                    }
                    // console.log(data);
                    // alert(data)
                }
            });

    }
    )

    
    

</script>